package org.liang.factory.factory;

import java.util.List;

import org.liang.factory.bean.BeanInfo;
import org.liang.factory.config.ClassConfig;
import org.liang.factory.excel.CreateExampleExcel;

public class CreateJavaCodeFactory extends CreateFactory{

	public void createJavaCode() {
		ClassConfig config = super.getConfig();
		//1、生成Bean对象
		List<BeanInfo> beanInfos = CreateExampleExcel.readExcelData(config);
		if(beanInfos == null) {
			return;
		}
		if(beanInfos.size() ==0) {
			System.err.println("可生成文件对象数为0");
			return;
		}
		//2、生成java文件
		BeanFactory.generateBeans(beanInfos);
	}
	
	public void printJavaCode() {
		ClassConfig config = super.getConfig();
		//1、生成Bean对象
		List<BeanInfo> beanInfos = CreateExampleExcel.readExcelData(config);
		if(beanInfos == null) {
			return;
		}
		if(beanInfos.size() ==0) {
			System.err.println("可生成文件对象数为0");
			return;
		}
		//2、生成java文件
		BeanFactory.printBeans(beanInfos);
	}
}
